#include <bits/stdc++.h>
using namespace std;
char s[10010];
bool vis[10010];
int len;
int FindMinOp(int Left, int Right)
{
    for(int i = Left; i < Right; i++)
        if(s[i] == '-' || s[i] == '+')
            return s[i];
}

int FirstLeft()
{
    for(int j = len - 1; j > 0; j--)
        if(s[j] == '(')
            return j;
}

int FindRight(int Left)
{
    for(int R = Left + 1, cnt = 1; R < len; R++)
    {
        if(s[R] == '(')
            cnt++;
        if(s[R] == ')')
            cnt--;
        if(cnt == 0)
            return R;
    }
}

void Work()
{
    for(int i = FirstLeft(); i > 0; i--)
    {
        if(s[i] == '(')
        {
            int R = FindRight(i);
            char MinOp = FindMinOp(i, R);
            if(s[i - 1] == '/')
                continue;
            else if((s[i - 1] == '+' || s[i - 1] == '-') && (MinOp == '+' || MinOp == '-'))
                continue;
            else if((s[R + 1] == '/' || s[R + 1] == '*') && (MinOp == '+' || MinOp == '-'))
                continue;
            else
            {
                vis[i] = true;
                vis[R] = true;
            }
        }
    }
}

int main()
{
    scanf("%s", s);
    len = strlen(s);
    Work();
    for(int i = 0; i < len; i++)
        if(!vis[i])
            printf("%c", s[i]);
    puts("");
    return 0;
}